import Vue from "vue";
import { checkPermision } from "~/utils/permision";

export default function({ app }) {
  Vue.directive("has", {
    inserted: function(el, binding) {
      if (el !== null && binding !== null) {
        if (checkPermision(app, binding.value, "widgets") == false) {
          if (el.parentNode !== null) {
            el.parentNode.removeChild(el);
          }
        }
      }
    },
    bind: function(el, binding, vnode) {}
  });
  //按钮权限
  Vue.directive("button", {
    inserted: function(el, binding) {
      // console.log(binding);
    }
  });
}
